package com.fc.test.api;

import com.fc.test.common.base.BaseController;
import com.fc.test.common.domain.AjaxResult;
import com.fc.test.model.auto.TAbbBanner;
import com.fc.test.service.TAbbBannerService;
import com.fc.test.util.JsonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/apiBannerController")
@Api(value = "Banner图")
public class ApiBannerController extends BaseController {

    @Autowired
    private TAbbBannerService tAbbBannerService;

    @ResponseBody
    @PostMapping(value="/getIndexBanner",produces = {"application/json; charset=utf-8"})
    @ApiOperation(value = "首页轮播图")
    public String  getIndexBanner(){
        Map<String,Object> resMap = new HashMap<>();
        List<TAbbBanner> list = tAbbBannerService.getIndexBanner();
        resMap.put("list",list);
        resMap.put("success",true);
        resMap.put("msg","获取Banner图成功");
        return JsonUtil.jsonMapStr(resMap);
    }


    @ResponseBody
    @PostMapping(value="/getHuigouBanner",produces = {"application/json; charset=utf-8"})
    @ApiOperation(value = "大商惠购轮播图")
    public String  getHuigouBanner(){
        Map<String,Object> resMap = new HashMap<>();
        List<TAbbBanner> list = tAbbBannerService.getHuigouBanner();
        resMap.put("list",list);
        resMap.put("success",true);
        resMap.put("msg","获取Banner图成功");
        return JsonUtil.jsonMapStr(resMap);
    }
}
